<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */

class proundefined_promotion_conditions_order_catmoney{
    public $tpl_name = "当某个分类商品的金额满X,给予优惠";
    //如果whole=true,那么getConfig必须返回字符串,否则必须返回数组
    // public $whole = true;
    public $type = 'order'; //标识显示那类优惠方案 enum('goods','order'); 为空在显示全部

    /**
     * @desc ：在选中这个促销条件时出现什么控件
     * @author jeff #TM_TH_DTTM
     * @param 参数类型
     * @return 返回值类型
    */
    public function getConfig($aData = array()) {
        // return 'aaa';
        /*
        商品促销中的返回:
        return array(
                  'type'=> 'b2c_sales_goods_aggregator_combine',
                  'aggregator'=> 'all',
                  'conditions'=> array(
                                   0 => array(
                                           'type' =>'b2c_sales_goods_item_goods',
                                           'attribute' => 'goods_cat_id'
                                         ),
                                   1 => array(
                                           'type' =>'b2c_sales_goods_item_goods',
                                           'attribute' => 'goods_buy_money'
                                         )
                                 )
                );

        当订单商品总价满X,对指定的商品优惠
        $aConfig['conditions']['type'] = 'html';
        $aConfig['conditions']['info'] = '';

        $aConfig['action_conditions']['type'] = 'config';
        $aConfig['action_conditions']['info'] = array(
            'aggregator'=>'all',
            'value'=>1,
            'conditions'=>array(
                            array(
                                'type'=>'b2c_sales_order_item_goods',
                                'attribute'=>'goods_goods_id'
                            )
                          )
         );
        */
        /////////////////////////////////////// conditions ////////////////////////////////////////
        //$aConfig['conditions']['type'] = 'html'说明要根据$this->getTemplate方法的返回显示条件设置区域
        //如果是config,可以
        //还可以是auto=config
        // $aConfig['conditions']['type'] = 'html';
        // $aConfig['conditions']['info'] = '';
        $aConfig['conditions'] = array(
            'type'=>'config',
            'info'=>array(
                'aggregator'=>'all',
                'value'=>1,
                'conditions'=>array(
                    array(
                        'type' =>'b2c_sales_goods_item_goods',
                        'attribute' => 'goods_cat_money'
                    )
                )
            )
        );

        ///////////////////////////////// action_conditions ///////////////////////////////////////////
        $aConfig['action_conditions']['type'] = 'auto';
        $aConfig['action_conditions']['info'] = array();
        return $aConfig;
    }

    //$aConfig['conditions']['type'] = 'html'说明要根据$this->getTemplate方法的返回显示条件设置区域
    //$aConfig['action_conditions']['type'] = 'html'说明要根据$this->getTemplate方法的返回显示条件设置区域
    public function getTemplate($aData = array(),$type = 'conditions') {
        return 'bbb';
        $___b2cs=app::get('b2c')->_('购物车商品数量满');

        switch($type) {
            case 'conditions':
                return  <<<EOF
        $___b2cs
    <input type="hidden" name="conditions[type]" value="b2c_sales_order_aggregator_combine" />
    <input type="hidden" name="conditions[aggregator]" value="all" />
    <input type="hidden" name="conditions[value]" value="1" />
    <input type="hidden" name="conditions[conditions][0][type]" value="b2c_sales_order_item_order" />
    <input type="hidden" name="conditions[conditions][0][attribute]" value="order_items_quantity" />
    <input type="hidden" name="conditions[conditions][0][operator]" value=">=" />
    <input type="text" name="conditions[conditions][0][value]" size="3" vtype="required&&digits" value="{$aData['conditions'][0]['value']}" />
EOF;
                break;
        }
    }
}

